package com.raylu.realtime.app.func;

import com.raylu.realtime.utils.DateUtil;
import org.apache.flink.table.annotation.DataTypeHint;
import org.apache.flink.table.annotation.InputGroup;
import org.apache.flink.table.api.DataTypes;
import org.apache.flink.table.functions.ScalarFunction;

import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * Description:
 * <p>
 * Create by lucienoz on 2022/1/9.
 * Copyright © 2022 lucienoz. All rights reserved.
 */
public class ConvertTimeStampFunction extends ScalarFunction {
    public ConvertTimeStampFunction() {
    }

    public LocalDateTime eval(Long ts) {
        return DateUtil.getLocalDateTime(ts);
    }

    public LocalDateTime eval(String ts) {
        return DateUtil.getLocalDateTime(DateUtil.getEpochMilli(ts));
    }
}
